<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="jquery.min.js"></script>
</head>

<body>
    <div id="container" class="container">
    <h2 class="form-signin-heading">上传文件</h2>
    <form id= "uploadForm">
          <p >上传文件：<input name="logFile" type="file" value="asdfasdf" class="form-control" /></ p>
              <input type="hidden" name="appName" value="shaozipc" onclick="doUpload()" />
              <input type="hidden" name="appKey" value="141234123412341234" onclick="doUpload()" />
          <input type="button" value="上传" onclick="doUpload()" />
    </form>
    </div>
    <script type="text/javascript">
        function doUpload() {
             var formData = new FormData($( "#uploadForm" )[0]);
             $.ajax({
                  url: 'http://localhost:3000/upload',
                  type: 'POST',
                  data: formData,
                  async: false,
                  cache: false,
                  contentType: false,
                  processData: false,
                  success: function (returndata) {
                      alert(returndata);
                  },
                  error: function (returndata) {
                      alert(returndata);
                  }
             });
        }
    </script>
</body>
</html>
